package com.fighter;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author Lei
 * @version 0.1
 * @date 2021/5/4
 */
@SpringBootApplication
@MapperScan("com.fighter.mapper")
public class MainApplication extends WebMvcConfigurerAdapter {


    public static void main(String[] args) {
        SpringApplication.run(MainApplication.class, args);
    }

    static final String ORIGINS[] = new String[] { "GET", "POST", "PUT", "DELETE" };
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**").allowedOrigins("*").allowCredentials(true).allowedMethods(ORIGINS)
                .maxAge(3600);
    }
}
